# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

# Maintainer: Sivanesh Ashok <sivaneshashok at gmail dot com>
# Submitter: noptrix

pkgname=hashcatch
pkgver=52.8145660
pkgrel=1
pkgdesc='Capture handshakes of nearby WiFi networks automatically.'
groups=('blackarch' 'blackarch-wireless' 'blackarch-cracker')
arch=('any')
url='https://github.com/staz0t/hashcatch/releases'
license=('GPL3')
depends=('bash' 'aircrack-ng' 'hashcat-utils' 'hcxtools' 'jq')
makedepends=('git')
source=("git+https://github.com/staz0t/$pkgname.git")
sha512sums=('SKIP')
install="$pkgname.install"

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

prepare() {
  cd $pkgname

  touch "$pkgname.conf"
  touch db
  mkdir -p handshakes
}

package() {
  cd $pkgname

  install -Dm 755 $pkgname "$pkgdir/usr/bin/$pkgname"
  install -Dm 644 "$pkgname.conf" "$pkgdir/etc/$pkgname/$pkgname.conf"
  install -Dm 755 db "$pkgdir/usr/share/$pkgname/db"
  install -dm 755 "$pkgdir/usr/share/$pkgname/handshakes"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

